package com.hy.schedule.controller;

import com.hy.schedule.util.ScheduleUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created With IntelliJ IDEA.
 * Descriptions:
 * author: Mr.Du
 * Date: 2023/6/9
 * Time: 14:12
 */
@RestController
@RequiredArgsConstructor
public class TestController {
    
    private final ScheduleUtils scheduleUtils;
    
    @GetMapping("/start")
    public String start(){
        scheduleUtils.startSchedule();
        return "成功";
    }
    
    @RequestMapping("/stop/{id}")
    public String stopSchedule( @PathVariable Long id){
        scheduleUtils.stopSchedule(id);
        return "成功";
    }
    
    @RequestMapping("/stopAll")
    public String stopAll(){
        scheduleUtils.stopAll();
        return "成功";
    }
}
